<%@ page language="java" import="java.util.*,com.fescoservice.model.*" pageEncoding="UTF-8" contentType="text/html; charset=utf-8"%>

<%
	String langfilename = "/resources/message";
	String serchOptionSel =  request.getAttribute("SerchOptionSel")==null?"":(String)request.getAttribute("SerchOptionSel");
	String serchOptionValue =  request.getAttribute("SerchOptionValueSel")==null?"":(String)request.getAttribute("SerchOptionValueSel");

	
%>
<%@include file="../common/LocaleManager.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Fesco Service</title>
		<link rel="stylesheet" href="<%=path%>/js/jquery/themes/redmond/jquery.ui.all.css">
		<script src="<%=path%>/js/jquery/jquery-1.5.1.js"></script>
		<script src="<%=path%>/js/FormCheck.js"></script>
		<script src="<%=path%>/js/common.js"></script>
	    <script src="<%=path%>/js/resources_zh_CN.js"></script>
		
		
		<script src="<%=path%>/js/jquery/external/jquery.bgiframe-2.1.2.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.core.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.widget.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.datepicker.js"></script>	
		<script src="<%=path%>/js/jquery/ui/jquery.ui.mouse.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.button.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.draggable.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.position.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.resizable.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.effects.core.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.effects.slide.js"></script>
		<link rel="stylesheet" href="<%=path%>/css/admin.css">
	
		<style type="text/css">
		
		</style>
		<script type="text/javascript">
			$(function() {
				$("#btnAdd").button().click(function() {
					//验空
					if (!check_empty("mainForm.passId|passValidDate|custFirstnameEn|custNameCn|birthDate|phone|companyName|companyAddr|custAddr"," <%=resource.getString("FS_T_CUST_PASS_ID")%> |<%=resource.getString("FS_T_CUST_PASS_VALID_DATE")%> | <%=resource.getString("FS_T_CUST_FIRSTNAME_EN")%> | <%=resource.getString("FS_T_CUST_NAME_CN")%> | <%=resource.getString("FS_T_CUST_BIRTH_DATE")%>| <%=resource.getString("FS_T_CUST_NAME_PHONE")%>  |<%=resource.getString("FS_T_CUST_COMPANY_NAME")%> |<%=resource.getString("FS_T_COMP_COMPANY_ADDR")%>|<%=resource.getString("FS_T_COMP_CUST_ADDR")%>"))
						return false;
					
					//验长度
					if (!check_length_zhCN("mainForm.passId|passValidDate|custFirstnameEn|custNameCn|birthDate|phone|companyName|companyAddr|custAddr","40|10|80|80|10|20|80|160|160"," <%=resource.getString("FS_T_CUST_PASS_ID")%> |<%=resource.getString("FS_T_CUST_PASS_VALID_DATE")%> | <%=resource.getString("FS_T_CUST_FIRSTNAME_EN")%> | <%=resource.getString("FS_T_CUST_NAME_CN")%> | <%=resource.getString("FS_T_CUST_BIRTH_DATE")%>| <%=resource.getString("FS_T_CUST_NAME_PHONE")%>  |<%=resource.getString("FS_T_CUST_COMPANY_NAME")%> |<%=resource.getString("FS_T_COMP_COMPANY_ADDR")%>|<%=resource.getString("FS_T_COMP_CUST_ADDR")%>")){
					    return false;
					}
					/* 验日期
					if(!check_date('mainForm.passValidDate',"'<%=resource.getString("FS_T_CUST_PASS_VALID_DATE")%>'"))
					{
							document.mainForm.passValidDate.value = "";		
							return false;
					}
					if(!check_date('mainForm.birthDate',"'<%=resource.getString("FS_T_CUST_BIRTH_DATE")%>'"))
					{
							document.mainForm.birthDate.value = "";		
							return false;
					}*/
									
					document.forms.mainForm.action = '<%=path%>/action/Customer.htm?cmd=addCustomer';
					document.forms.mainForm.submit();		
				});
				$("#btnBack").button().click(function() {
					document.forms.mainForm.action = '<%=path%>/action/Customer.htm?cmd=list';
					//document.forms.mainForm.type.value=""
					document.forms.mainForm.submit();		
				});
							
				
				$('#srchCompanyBtn').button().click(function (){	
					
					var compId = $('#companyInput').val();
					$("#companyList").load("<%=path%>/action/Manage.htm?cmd=getCompanyList&name="+encodeURI(compId)+"&time=<%=System.currentTimeMillis()%>"); 
					$("#companyList")[0].style.display="";//.show();
					
				});
				
				
				$( "#passValidDate" ).datepicker({
					changeMonth: true,
					changeYear: true
				 });
				 $( "#birthDate" ).datepicker({
					changeMonth: true,
					changeYear: true
				 });
				 $("#companyList")[0].style.display="none";//.hide();
			});
			
			
			function checkId(value){
				ManageAjaxController.checkId(value,
						{callback:function(dataFromServer){
								if("true"=dataFromServer){
									$("#IdRepeatTips").style.display="inline";
								}else{
									$("#IdRepeatTips").style.display="none";
								}
							} 
						}); 	
			}

		</script>
	</head>
	<body>
		
		<div class="wrapContent">	
			<div class="ui-widget">	
				<div class="ui-widget-header">
					<%=resource.getString("FS_T_ADD")%><%=resource.getString("FS_T_CUSTOMER")%>
				</div>
				<div class="ui-widget-content operatorForm">
					<form name="mainForm" method="post">
						<fieldset >
							<label for="custNameEn">
								<%=resource.getString("FS_T_CUST_FIRSTNAME_EN")%>
							</label>
							<input type="text" name="custFirstnameEn" class=" ui-corner-all" value="" maxlength = "80"  />
						</fieldset>
						<fieldset >
							<label for="custNameEn">
								<%=resource.getString("FS_T_CUST_LASTNAME_EN")%>
							</label>
							<input type="text" name="custLastnameEn" class=" ui-corner-all" value="" maxlength = "80"  />
						</fieldset>
						<fieldset>
							<label for="passId">
								<%=resource.getString("FS_T_CUST_PASS_ID")%>
							</label>
							<input type="hidden" name="SerchOptionSel" class=" ui-corner-all" value="<%=serchOptionSel %>" />	
							<input type="hidden" name="SerchOptionValueSel" class=" ui-corner-all" value="<%=serchOptionValue %>" />
							<input type="text" name="passId" class=" ui-corner-all" value="" maxlength = "40" />				
						</fieldset>
						
						<fieldset >
							<label for="passValidDate">
								<%=resource.getString("FS_T_CUST_PASS_VALID_DATE")%>
							</label>
							<input id="passValidDate" type="text" name="passValidDate" class=" ui-corner-all" value="" maxlength = "10"  />
						</fieldset>
						
						
						
						
						<fieldset >
							<label for="custNameCn">
								<%=resource.getString("FS_T_CUST_NAME_CN")%>
							</label>
							<input type="text" name="custNameCn" class=" ui-corner-all" value="" maxlength = "80"/>
						</fieldset>
						
						<fieldset >
							<label for="birthDate">
								<%=resource.getString("FS_T_CUST_BIRTH_DATE")%>
							</label>
							<input id="birthDate" type="text" name="birthDate" class=" ui-corner-all" value="" maxlength = "10"/>
						</fieldset>
						
						<fieldset >
							<label for="phone">
								<%=resource.getString("FS_T_CUST_NAME_PHONE")%>
							</label>
							<input type="text" name="phone" class=" ui-corner-all" value="" maxlength = "20"/>
						</fieldset>
						
						<fieldset >
							<label for="companyName">
								<%=resource.getString("FS_T_CUST_COMPANY_NAME")%>
							</label>
							<input id="companyInput" type="text" name="companyName" class=" ui-corner-all" value="" maxlength = "80"/>
							<input id="companyIdInput" type="hidden" name="companyId" class=" ui-corner-all" value="" maxlength = "10"/>
							<span id="srchCompanyBtn" ><%=resource.getString("FS_T_SEARCH")%></span>
							
						</fieldset>
						
						
						
						<fieldset >
							<label for="companyAddr">
								<%=resource.getString("FS_T_COMP_COMPANY_ADDR")%>
							</label>
							<input id="companyAddrInput" type="text" name="companyAddr" class=" ui-corner-all" value="" maxlength = "160"/>
						</fieldset>
						<fieldset >
							<label for="custAddr">
								<%=resource.getString("FS_T_COMP_CUST_ADDR")%>
							</label>
							<input type="text" name="custAddr" class=" ui-corner-all" value="" maxlength = "160"/>
						</fieldset>
						
						
					</form>	
					<div class="clear"></div>
				</div>
			
				<div class="buttonGroupRight">
			   		<div id="btnAdd" ><%=resource.getString("FS_T_SAVE")%></div>
					<div id="btnBack" ><%=resource.getString("FS_T_LIST")%></div>
				</div>	
			
			</div>
		</div>
		<div id="companyList" >
		
		</div>
		<script type="text/javascript"	>	
		//import scripts below to pages which display in right frame, for ajust the scroll height
		parent.scroll(0,0);
		parent.setFrameHeight(document.body.scrollHeight+200);
		</script>
	</body>
</html>